package com.wondertek.liveroom;

import java.util.List;

import com.jasontools.data.Host;
import com.jasontools.data.LiveChannelPc;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class MyHostAdapter extends BaseAdapter{
	private Context context = null;
	private LayoutInflater inflater = null;
	private List<Host> hostData = null;
	
	public MyHostAdapter(Context context, List<Host> hostData){
		this.context = context;
		inflater = LayoutInflater.from(context);
		this.hostData = hostData;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return 5;
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub		
		return hostData.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return arg0;
	}

	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {
		// TODO Auto-generated method stub
		ViewHolder holder;
		if (null == arg1) {
			arg1 = inflater.inflate(R.layout.item_host_gride, null);
			holder = new ViewHolder();
			holder.ivHostHeader = (ImageView) arg1.findViewById(R.id.iv_host_header);
			holder.tvHostNmae = (TextView) arg1.findViewById(R.id.tv_host_name);
			arg1.setTag(holder);
		} else {
			holder = (ViewHolder) arg1.getTag();
		}
		return arg1;
	}
	
	private class ViewHolder {
		public ImageView ivHostHeader;
		public TextView tvHostNmae;
	}

}
